package brainsplash.gyrusscope.game;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.util.ArrayList;
import java.util.Random;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

import brainsplash.gyrusscope.game.Assets;
import brainsplash.gyrusscope.game.MainMenuScreen;
import brainsplash.gyrusscope.game.Settings;

import brainsplash.gyrusscope.game.R;

import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.opengl.GLSurfaceView;
import android.opengl.GLU;
import android.opengl.GLUtils;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.Window;
import android.view.WindowManager;

import brainsplash.gyrusscope.framework.Screen;
import brainsplash.gyrusscope.framework.impl.GLGame;

public class Gyrusscope extends GLGame {
    boolean firstTimeCreate = true;
    
    //@Override
    public Screen getStartScreen() {
        return new MainMenuScreen(this);
    }
    
    @Override
    public void onSurfaceCreated(GL10 gl, EGLConfig config) {         
        super.onSurfaceCreated(gl, config);
        if(firstTimeCreate) {
            Settings.load(getFileIO());
            Assets.load(this);
            Particles.partSystems.add(new ParticleSystem(Assets.star, 2, (int) WorldRenderer.FRUSTUM_WIDTH / 2, (int) WorldRenderer.FRUSTUM_HEIGHT / 2,
            		0, -4, -1, 2, 360, 4, 100, 0));
            firstTimeCreate = false;            
        } else {
            Assets.reload();
        }
    }     
    
    @Override
    public void onPause() {
        super.onPause();
        if(Settings.soundEnabled)
            Assets.music.pause();
    }
}

